fix: crash when changing a plugin node's input port configuration - #1177
Open
ctruett wants to merge 1 commit into
Open
fix: crash when changing a plugin node's input port configuration#1177ctruett wants to merge 1 commit into
ctruett wants to merge 1 commit into
Conversation
A connection can outlive the port configuration it was created against: changing a plugin node's input buses renumbers its ports while the old arcs still reference them, and the rendering sequence is rebuilt before removeIllegalConnections() runs. GraphBuilder consumed those stale arcs unconditionally; a stale audio arc whose dest port index now lands on a Control port produced a BindParameterOp with a null source parameter, crashing in its constructor. Filter arcs through isConnectionLegal() in createRenderingOpsForNode - the same invariant addConnection() enforces when arcs are created. This also hardens the async PortResetter path, which has the same window between refreshPorts() and removeIllegalConnections(). Adds a regression test (BusesLayoutTests) reproducing the exact EngineService::changeBusesLayout sequence with an 8-input plugin shrunk to mono while connected.
ctruett
marked this pull request as ready for review
August 31, 2026 06:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a crash (SIGSEGV) that occurs when applying a new input bus layout to a connected plugin node from the node's I/O configuration window.
GraphBuilder::createRenderingOpsForNodenow filters connections throughisConnectionLegal()before consuming them — the same invariantaddConnection()enforces when arcs are created, and the same predicateremoveIllegalConnections()uses for cleanup.Root cause
Connections can outlive the port configuration they were created against. The crash sequence:
EngineService::changeBusesLayoutapplies the new buses viasetBusesLayoutWithoutEnabling()and renumbers the node's ports (node.resetPorts()).connectionsarray still holds arcs referencing the old port indices.prepareToRender()→buildRenderingSequence()) beforeremoveIllegalConnections()purges the stale arcs.BindParameterOp (src->getParameter (srcPort), node->getParameter (port))(graphbuilder.cpp:657).Processor::getParameter()returnsnullptrfor non-Control ports, andBindParameterOp's constructor callsparam1->addListener (this)unconditionally → null dereference.Why the filter belongs in the builder: the window between port renumbering and
removeIllegalConnections()exists in every reconfiguration path — the sync service flow, the asyncProcessor::PortResetterpath, and any future one. Guarding at the consumption site closes all of them. It also mirrors the implicit protection in JUCE's ownAudioProcessorGraphbuilder, which iterates channels bounded by the current layout rather than raw connections.Changes
src/engine/graphbuilder.cpp—createRenderingOpsForNode: skip arcs failingisConnectionLegal(). 4 lines + comment.test/BusesLayoutTests.cpp— newBusesLayoutTestssuite reproducing the exactchangeBusesLayoutsequence (8-input processor with 8 parameters shrunk to mono while connected); crashes on the old code, passes now.test/CMakeLists.txt— CTest registration for the new suite.Testing
BusesLayoutTests(red → green; SIGSEGV exit 139 before the fix).ctest), including rebase onto currentmain.Notes
The service flow still rebuilds before purging stale arcs (
removeIllegalConnections()runs afterprepareToRender()inchangeBusesLayout). That ordering is harmless with this guard in place, but reordering it would be reasonable follow-up hardening — kept out of this PR to stay minimal.